package com.example.zhaojianxu.signin.common.account.viewModel

import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.ViewModel
import com.example.zhaojianxu.signin.common.account.model.AccountEntity
import com.example.zhaojianxu.signin.common.account.model.UserEntity
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch

class AccountViewModel : ViewModel() {

    val mLogin = MutableLiveData<UserEntity>()
    val mLogon = MutableLiveData<String>()

    fun postLogin(account: String,password: String) {
        GlobalScope.launch {
            mLogin.postValue(AccountRequest.postLogin(account,password).await())
        }
    }

    fun postLogon(account: String,password: String,name: String,number: String) {
        GlobalScope.launch {
            mLogon.postValue(AccountRequest.postLogon(account,password,name,number).await())
        }
    }
}